﻿using System;
using System.Text;
using System.Data;
using System.Data.Common;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Data.Schema.UnitTesting;
using Microsoft.Data.Schema.UnitTesting.Conditions;

namespace SSISDBExtensions.Test
{
    [TestClass()]
    public class PutETLJob : DatabaseTestClass
    {

        public PutETLJob()
        {
            InitializeComponent();
        }

        [TestInitialize()]
        public void TestInitialize()
        {
            base.InitializeTest();
        }
        [TestCleanup()]
        public void TestCleanup()
        {
            base.CleanupTest();
        }

        [TestMethod()]
        public void PutETLJob_Create()
        {
            DatabaseTestActions testActions = this.PutETLJob_CreateData;
            // Execute the pre-test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.PretestAction != null), "Executing pre-test script...");
            ExecutionResult[] pretestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PretestAction);
            // Execute the test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.TestAction != null), "Executing test script...");
            ExecutionResult[] testResults = TestService.Execute(this.ExecutionContext, this.PrivilegedContext, testActions.TestAction);
            // Execute the post-test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.PosttestAction != null), "Executing post-test script...");
            ExecutionResult[] posttestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PosttestAction);
        }
        [TestMethod()]
        public void PutETLJob_AddInSameThingASecondTime()
        {
            DatabaseTestActions testActions = this.PutETLJob_AddInSameThingASecondTimeData;
            // Execute the pre-test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.PretestAction != null), "Executing pre-test script...");
            ExecutionResult[] pretestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PretestAction);
            // Execute the test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.TestAction != null), "Executing test script...");
            ExecutionResult[] testResults = TestService.Execute(this.ExecutionContext, this.PrivilegedContext, testActions.TestAction);
            // Execute the post-test script
            // 
            System.Diagnostics.Trace.WriteLineIf((testActions.PosttestAction != null), "Executing post-test script...");
            ExecutionResult[] posttestResults = TestService.Execute(this.PrivilegedContext, this.PrivilegedContext, testActions.PosttestAction);
        }


        #region Designer support code

        /// <summary> 
        /// Required method for Designer support - do not modify 
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            Microsoft.Data.Schema.UnitTesting.DatabaseTestAction PutETLJob_Create_TestAction;
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PutETLJob));
            Microsoft.Data.Schema.UnitTesting.Conditions.NotEmptyResultSetCondition ETLJobNameMustExistInDB;
            Microsoft.Data.Schema.UnitTesting.DatabaseTestAction PutETLJob_Create_PosttestAction;
            Microsoft.Data.Schema.UnitTesting.DatabaseTestAction PutETLJob_AddInSameThingASecondTime_TestAction;
            Microsoft.Data.Schema.UnitTesting.Conditions.RowCountCondition PutETLJob_AddInSameThingASecondTime_Rowcount;
            Microsoft.Data.Schema.UnitTesting.DatabaseTestAction PutETLJob_AddInSameThingASecondTime_PosttestAction;
            Microsoft.Data.Schema.UnitTesting.DatabaseTestAction PutETLJob_AddInSameThingASecondTime_PretestAction;
            Microsoft.Data.Schema.UnitTesting.DatabaseTestAction PutETLJob_Create_PretestAction;
            this.PutETLJob_CreateData = new Microsoft.Data.Schema.UnitTesting.DatabaseTestActions();
            this.PutETLJob_AddInSameThingASecondTimeData = new Microsoft.Data.Schema.UnitTesting.DatabaseTestActions();
            PutETLJob_Create_TestAction = new Microsoft.Data.Schema.UnitTesting.DatabaseTestAction();
            ETLJobNameMustExistInDB = new Microsoft.Data.Schema.UnitTesting.Conditions.NotEmptyResultSetCondition();
            PutETLJob_Create_PosttestAction = new Microsoft.Data.Schema.UnitTesting.DatabaseTestAction();
            PutETLJob_AddInSameThingASecondTime_TestAction = new Microsoft.Data.Schema.UnitTesting.DatabaseTestAction();
            PutETLJob_AddInSameThingASecondTime_Rowcount = new Microsoft.Data.Schema.UnitTesting.Conditions.RowCountCondition();
            PutETLJob_AddInSameThingASecondTime_PosttestAction = new Microsoft.Data.Schema.UnitTesting.DatabaseTestAction();
            PutETLJob_AddInSameThingASecondTime_PretestAction = new Microsoft.Data.Schema.UnitTesting.DatabaseTestAction();
            PutETLJob_Create_PretestAction = new Microsoft.Data.Schema.UnitTesting.DatabaseTestAction();
            // 
            // PutETLJob_Create_TestAction
            // 
            PutETLJob_Create_TestAction.Conditions.Add(ETLJobNameMustExistInDB);
            resources.ApplyResources(PutETLJob_Create_TestAction, "PutETLJob_Create_TestAction");
            // 
            // ETLJobNameMustExistInDB
            // 
            ETLJobNameMustExistInDB.Enabled = true;
            ETLJobNameMustExistInDB.Name = "ETLJobNameMustExistInDB";
            ETLJobNameMustExistInDB.ResultSet = 1;
            // 
            // PutETLJob_Create_PosttestAction
            // 
            resources.ApplyResources(PutETLJob_Create_PosttestAction, "PutETLJob_Create_PosttestAction");
            // 
            // PutETLJob_AddInSameThingASecondTime_TestAction
            // 
            PutETLJob_AddInSameThingASecondTime_TestAction.Conditions.Add(PutETLJob_AddInSameThingASecondTime_Rowcount);
            resources.ApplyResources(PutETLJob_AddInSameThingASecondTime_TestAction, "PutETLJob_AddInSameThingASecondTime_TestAction");
            // 
            // PutETLJob_AddInSameThingASecondTime_Rowcount
            // 
            PutETLJob_AddInSameThingASecondTime_Rowcount.Enabled = true;
            PutETLJob_AddInSameThingASecondTime_Rowcount.Name = "PutETLJob_AddInSameThingASecondTime_Rowcount";
            PutETLJob_AddInSameThingASecondTime_Rowcount.ResultSet = 1;
            PutETLJob_AddInSameThingASecondTime_Rowcount.RowCount = 1;
            // 
            // PutETLJob_AddInSameThingASecondTime_PosttestAction
            // 
            resources.ApplyResources(PutETLJob_AddInSameThingASecondTime_PosttestAction, "PutETLJob_AddInSameThingASecondTime_PosttestAction");
            // 
            // PutETLJob_CreateData
            // 
            this.PutETLJob_CreateData.PosttestAction = PutETLJob_Create_PosttestAction;
            this.PutETLJob_CreateData.PretestAction = PutETLJob_Create_PretestAction;
            this.PutETLJob_CreateData.TestAction = PutETLJob_Create_TestAction;
            // 
            // PutETLJob_AddInSameThingASecondTimeData
            // 
            this.PutETLJob_AddInSameThingASecondTimeData.PosttestAction = PutETLJob_AddInSameThingASecondTime_PosttestAction;
            this.PutETLJob_AddInSameThingASecondTimeData.PretestAction = PutETLJob_AddInSameThingASecondTime_PretestAction;
            this.PutETLJob_AddInSameThingASecondTimeData.TestAction = PutETLJob_AddInSameThingASecondTime_TestAction;
            // 
            // PutETLJob_AddInSameThingASecondTime_PretestAction
            // 
            resources.ApplyResources(PutETLJob_AddInSameThingASecondTime_PretestAction, "PutETLJob_AddInSameThingASecondTime_PretestAction");
            // 
            // PutETLJob_Create_PretestAction
            // 
            resources.ApplyResources(PutETLJob_Create_PretestAction, "PutETLJob_Create_PretestAction");
        }

        #endregion


        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        #endregion

        private DatabaseTestActions PutETLJob_CreateData;
        private DatabaseTestActions PutETLJob_AddInSameThingASecondTimeData;
    }
}
